<template>
<div class="page-container page-container-detail-page">
	<div class="toolbar page-container-detail ">
      <el-tabs v-model="activeName" class="tabs">
        <el-tab-pane label="选择获取方式" name="first" :disabled="true">
          <el-form ref="growthRuleForm" :rules="growthRuleForms" :model="growthRuleForm">
            <el-form-item
              label="获取方式："
              prop="obtainMode"
              class="w326 mb20" 
            >
              <el-select
                v-model="growthRuleForm.obtainMode"
                @change="selectModel($event)"
                :disabled="editDis"
                placeholder="选择获取方式"
                class="width326"
                clearable
              >
                <el-option
                  v-for="item in obtainModeList"
                  :key="item.obtainMode"
                  :label="item.obtainName"
                  :value="item.obtainMode"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item
              label="规则名称："
              prop="ruleName"
            >
              <el-input
                v-model="growthRuleForm.ruleName"
                maxlength="20"
                :size="size"
                placeholder="输入规则名称"
                style="width: 300px"
                clearable
                class="width326"
              ></el-input>
              <p class="mb200 font12 colorE7 pl127">最多输入20个字符</p>
            </el-form-item>
            <el-row class="t_c">
              <el-button
                :size="size"
                @click="returnRuleList()"
                plain
                type="primary"
                class="mr60"
              >{{ $t("action.cancel")}}</el-button>
              <el-button
                :size="size"
                type="primary"
                @click="nextStepRuleGrowth(1)"
                :lodaing="editLoading"
              >下一步</el-button>
            </el-row>
          </el-form>
        </el-tab-pane>
        <el-tab-pane :label="createOrUpdateRuleType" :disabled="true" name="second">
          <el-form ref="growthRuleForm" :rules="growthRuleForms" :model="growthRuleForm">
            
            <el-row v-if="this.growthRuleForm.obtainMode == 1">
              <el-form>
                <el-radio-group v-model="orderRadio">
                  <el-row class="mb30">
                    <span class="font16 color000">下单赠送</span>
                  </el-row>
                  <el-radio label="3" class="mb30 mr60 color333">每消费赠送</el-radio>
                  <el-radio label="6" class="mb30 color333">阶梯消费赠送</el-radio>
                  <el-form-item
                    class="everyCostHandleSel mb30"
                    v-if="this.orderRadio == 3"
                    prop="consumeMoney"
                  >
                    <span style="color:red">*</span>
                    <span class="color666">每消费：&nbsp;</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.consumeMoney"
                      @input="growthRuleForm.consumeMoney=growthRuleForm.consumeMoney.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                      clearable
                    ></el-input>
                    <span class="color666">元，赠送</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthVal"
                      @input="growthRuleForm.giveGrowthVal=growthRuleForm.giveGrowthVal.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                      clearable
                    ></el-input>
                    <span class="color666">成长值</span>
                  </el-form-item>
                  <el-form-item
                    class="everyCostHandleSel"
                    v-if="this.orderRadio == 6"
                    prop="orderHandleSel"
                  >
                    <div
                      v-for="(item,index) in growthRuleForm.orderHandleSel"
                      :key="index"
                      class="mb30"
                    >
                      <el-form-item class="mb30">
                        <span class="font16 color000">消费：</span>
                      </el-form-item>
                      <el-input
                        placeholder="输入数字"
                        v-model="growthRuleForm.orderHandleSel[index].consumeMoney"
                        @input="growthRuleForm.orderHandleSel[index].consumeMoney=growthRuleForm.orderHandleSel[index].consumeMoney.replace(/[^\d.]/g,'')"
                        maxlength="5"
                        class="w326"
                        clearable
                      ></el-input>
                      <span class="color666">&nbsp;元，赠送</span>
                      <el-input
                        placeholder="输入数字"
                        v-model="growthRuleForm.orderHandleSel[index].giveGrowthVal"
                        @input="growthRuleForm.orderHandleSel[index].giveGrowthVal=growthRuleForm.orderHandleSel[index].giveGrowthVal.replace(/[^\d.]/g,'')"
                        maxlength="5"
                        class="w326"
                        clearable
                      ></el-input>
                      <span class="color666">成长值</span>
                      <el-button
                        :size="size"
                        type="text"
                        @click="addOrderHandleSel(index)"
                        v-if="index==0"
                      >添加</el-button>
                      <el-button
                        :size="size"
                        type="text"
                        @click="celarOrderHandleSel(index)"
                        v-if="index != 0"
                        class="textRed noMarginL"
                      >删除</el-button>
                    </div>
                  </el-form-item>
                </el-radio-group>
                <el-form-item required class="mb120">
                  <el-form-item class="everyCostHandleSel" prop="giveGrowthMaxNum">
                    <span class="color666">每日上限：</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthMaxNum"
                      @input="growthRuleForm.giveGrowthMaxNum=growthRuleForm.giveGrowthMaxNum.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      clearable
                      class="w326"
                    ></el-input>
                    <span class="color666">成长值</span>
                  </el-form-item>
                </el-form-item>
              </el-form>
            </el-row>
            <el-row v-if="this.growthRuleForm.obtainMode == 2">
              <el-row class="mb30">
                <span class="font16 color000">注册赠送</span>
              </el-row>
              <el-form-item
                label="新用户注册发放："
                prop="giveGrowthVal"
                class="mb120 labelColor666 labelTextSize14"
              >
                <el-input
                  placeholder="输入数字"
                  v-model="growthRuleForm.giveGrowthVal"
                  class="w326"
                  @input="growthRuleForm.giveGrowthVal=growthRuleForm.giveGrowthVal.replace(/[^\d.]/g,'')"
                  maxlength="5"
                  clearable
                ></el-input>
                <span class="color666">成长值</span>
              </el-form-item>
            </el-row>
            <el-row v-if="this.growthRuleForm.obtainMode == 3">
              <el-form>
                <el-checkbox-group v-model="whetherPicList">
                  <el-form-item required>
                    <el-row class="mb30">
                      <span class="font16 color000">评价赠送</span>
                    </el-row>
                    <el-row class="mb30">
                      <el-checkbox label="带图"></el-checkbox>
                    </el-row>
                    <el-form-item class="everyCostHandleSel mb30" prop="appGiveGrowthVal">
                      <span style="color:red">*</span>
                      <span>完成评价赠送：</span>
                      <el-input
                        placeholder="输入数字"
                        v-model="growthRuleForm.appGiveGrowthVal"
                        @input="growthRuleForm.appGiveGrowthVal=growthRuleForm.appGiveGrowthVal.replace(/[^\d.]/g,'')"
                        maxlength="5"
                        class="w326"
                        clearable
                      ></el-input>
                      <span>成长值</span>
                    </el-form-item>
                  </el-form-item>
                  <el-form-item required>
                    <el-form-item class="everyCostHandleSel mb30" prop="appGiveGrowthMaxNum">
                      <span class="w115">每日上限：</span>
                      <el-input
                        placeholder="输入数字"
                        v-model="growthRuleForm.appGiveGrowthMaxNum"
                        @input="growthRuleForm.appGiveGrowthMaxNum=growthRuleForm.appGiveGrowthMaxNum.replace(/[^\d.]/g,'')"
                        maxlength="5"
                        clearable
                        class="w326"
                      ></el-input>
                      <span>成长值</span>
                    </el-form-item>
                  </el-form-item>

                  <el-form-item required>
                    <el-row class="mb30">
                      <el-checkbox label="不带图"></el-checkbox>
                    </el-row>
                    <el-form-item class="everyCostHandleSel mb30" prop="appGiveGrowthVals">
                      <span style="color:red">*</span>
                      <span>完成评价赠送：</span>
                      <el-input
                        placeholder="输入数字"
                        v-model="growthRuleForm.appGiveGrowthVals"
                        @input="growthRuleForm.appGiveGrowthVals=growthRuleForm.appGiveGrowthVals.replace(/[^\d.]/g,'')"
                        maxlength="5"
                        class="w326"
                        clearable
                      ></el-input>
                      <span>成长值</span>
                    </el-form-item>
                  </el-form-item>
                  <el-form-item required>
                    <el-form-item class="everyCostHandleSel mb120" prop="appGiveGrowthMaxNums">
                      <span class="w115">每日上限：</span>
                      <el-input
                        placeholder="输入数字"
                        v-model="growthRuleForm.appGiveGrowthMaxNums"
                        @input="growthRuleForm.appGiveGrowthMaxNums=growthRuleForm.appGiveGrowthMaxNums.replace(/[^\d.]/g,'')"
                        maxlength="5"
                        class="w326"
                        clearable
                      ></el-input>
                      <span>成长值</span>
                    </el-form-item>
                  </el-form-item>
                </el-checkbox-group>
              </el-form>
            </el-row>
            <el-row v-if="this.growthRuleForm.obtainMode == 4">
              <el-form>
                <el-radio-group v-model="costRadio">
                  <el-row class="mb30">
                    <span class="font16 color000">充值赠送</span>
                  </el-row>
                  <el-radio label="3" class="mb30 mr60">每充值赠送</el-radio>
                  <el-radio label="6" class="mb30">阶梯充值赠送</el-radio>
                  <el-form-item class="everyCostHandleSel mb30" v-if="this.costRadio == 3">
                    <span style="color:red">*</span>
                    <span>每充值：&nbsp;</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.consumeMoney "
                      @input="growthRuleForm.consumeMoney=growthRuleForm.consumeMoney.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                      clearable
                    ></el-input>
                    <span>元，赠送</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthVal"
                      @input="growthRuleForm.giveGrowthVal=growthRuleForm.giveGrowthVal.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                      clearable
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                  <el-form-item class="everyCostHandleSel" v-if="this.costRadio == 6">
                    <div
                      v-for="(item,index) in growthRuleForm.costHandleSel"
                      :key="index"
                      class="mb30"
                    >
                      <el-form-item class="mb30">
                        <span class="font16 color000">充值：</span>
                      </el-form-item>
                      <el-input
                        placeholder="输入数字"
                        v-model="item.consumeMoney"
                        @input="item.consumeMoney=item.consumeMoney.replace(/[^\d.]/g,'')"
                        maxlength="5"
                        class="w326"
                        clearable
                      ></el-input>
                      <span>&nbsp;元，赠送</span>
                      <el-input
                        placeholder="输入数字"
                        v-model="item.giveGrowthVal"
                        @input="item.giveGrowthVal=item.giveGrowthVal.replace(/[^\d.]/g,'')"
                        maxlength="5"
                        class="w326"
                        clearable
                      ></el-input>
                      <span>成长值</span>
                      <el-button
                        :size="size"
                        type="text"
                        @click="addCostHandleSel(index)"
                        v-show="index==0"
                      >添加</el-button>
                      <el-button
                        :size="size"
                        type="text"
                        class="textRed noMarginL"
                        @click="celarCostHandleSel(index)"
                        v-if="index != 0"
                      >删除</el-button>
                    </div>
                  </el-form-item>
                </el-radio-group>
                <el-form-item required class="mb120">
                  <el-form-item class="everyCostHandleSel" prop="giveGrowthMaxNum">
                    <span>每日上限：</span>
                    <el-input
                      class="w326"
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthMaxNum"
                      @input="growthRuleForm.giveGrowthMaxNum=growthRuleForm.giveGrowthMaxNum.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      clearable
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
              </el-form>
            </el-row>
            <el-row v-if="this.growthRuleForm.obtainMode == 5">
              <el-form>
                <el-form-item required>
                  <el-row class="mb30">
                    <span class="font16 color000">分享赠送</span>
                  </el-row>
                  <el-form-item class="everyCostHandleSel mb30">
                    <span style="color:red">*</span>
                    <span>完成分享，赠送</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthVal"
                       @input="growthRuleForm.giveGrowthVal=growthRuleForm.giveGrowthVal.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      clearable
                      class="w326"
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
                <el-form-item required>
                  <el-form-item class="everyCostHandleSel mb120">
                    <span class="w115">每日上限：</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthMaxNum"
                      @input="growthRuleForm.giveGrowthMaxNum=growthRuleForm.giveGrowthMaxNum.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      clearable
                      class="w326"
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
              </el-form>
            </el-row>
            <el-row v-if="this.growthRuleForm.obtainMode == 6">
              <el-form>
                <el-form-item required>
                  <el-row class="mb30">
                    <span class="font16 color000">点赞赠送</span>
                  </el-row>
                  <el-form-item class="everyCostHandleSel mb30">
                    <span style="color:red">*</span>
                    <span>完成点赞，赠送</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthVal"
                      @input="growthRuleForm.giveGrowthVal=growthRuleForm.giveGrowthVal.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                      clearable
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
                <el-form-item required>
                  <el-form-item class="everyCostHandleSel mb120">
                    <span class="w115">每日上限：</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthMaxNum"
                      @input="growthRuleForm.giveGrowthMaxNum=growthRuleForm.giveGrowthMaxNum.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                      clearable
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
              </el-form>
            </el-row>
            <el-row v-if="this.growthRuleForm.obtainMode == 7">
              <el-form>
                <el-form-item required>
                  <el-row class="mb30">
                    <span class="font16 color000">晒单赠送</span>
                  </el-row>
                  <el-form-item class="everyCostHandleSel mb30">
                    <span style="color:red">*</span>
                    <span>完成晒单，赠送</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthVal"
                     @input="growthRuleForm.giveGrowthVal=growthRuleForm.giveGrowthVal.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                      clearable
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
                <el-form-item required>
                  <el-form-item class="everyCostHandleSel mb120">
                    <span class="w115">每日上限：</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthMaxNum"
                      @input="growthRuleForm.giveGrowthMaxNum=growthRuleForm.giveGrowthMaxNum.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                      clearable
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
              </el-form>
            </el-row>
            <el-row v-if="this.growthRuleForm.obtainMode == 8">
              <el-form>
                <el-form-item required>
                  <el-row class="mb30">
                    <span class="font16 color000">收藏赠送</span>
                  </el-row>
                  <el-form-item class="everyCostHandleSel mb30">
                    <span style="color:red">*</span>
                    <span>完成收藏，赠送</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthVal"
                      @input="growthRuleForm.giveGrowthVal=growthRuleForm.giveGrowthVal.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
                <el-form-item required>
                  <el-form-item class="everyCostHandleSel mb120">
                    <span class="w115">每日上限：</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthMaxNum"
                      @input="growthRuleForm.giveGrowthMaxNum=growthRuleForm.giveGrowthMaxNum.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
              </el-form>
            </el-row>
            <el-row v-if="this.growthRuleForm.obtainMode > 8">
              <el-form>
                <el-form-item required>
                  <el-row class="mb30">
                    <span class="font16 color000">{{this.obtainName}}赠送</span>
                  </el-row>
                  <el-form-item class="everyCostHandleSel mb30">
                    <span style="color:red">*</span>
                    <span>{{this.obtainName}}，赠送</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthVal"
                      @input="growthRuleForm.giveGrowthVal=growthRuleForm.giveGrowthVal.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
                <el-form-item required>
                  <el-form-item class="everyCostHandleSel mb120">
                    <span class="w115">每日上限：</span>
                    <el-input
                      placeholder="输入数字"
                      v-model="growthRuleForm.giveGrowthMaxNum"
                      @input="growthRuleForm.giveGrowthMaxNum=growthRuleForm.giveGrowthMaxNum.replace(/[^\d.]/g,'')"
                      maxlength="5"
                      class="w326"
                    ></el-input>
                    <span>成长值</span>
                  </el-form-item>
                </el-form-item>
              </el-form>
            </el-row>
          </el-form>
          <div class="t_c">
            <el-button
              :size="size"
              type="primary"
              @click="upStep(2)"
              :loading="editLoading"
              class="mr60"
            >上一步</el-button>
            <el-button
              :size="size"
              type="primary"
              @click="nextStepRuleGrowth(2)"
              :loading="editLoading"

              class="mr60"
            >下一步</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane :label="createOrUpdateSuccess" :disabled="true" name="third">
          <div class="positionDes">
            <span class="ruleClass font16">
              <img src="../../../assets/success.png" class="successImg" />
              <span v-if="this.setRule == true">规则创建成功</span>
               <span v-if="this.setRule == false">规则修改成功</span>
            </span>
            <img v-bind:src="imgUrl" />
          </div>
          <div class="positionDes">
            <span class="ruleDes font12 colorOrange mb120 turnInlineBlock" v-if="this.setRule == true">该规则现为【停用】状态，请手动操作【启用】</span>
          </div>
          <div class="positionDes">
            <el-button :size="size" type="primary" @click="returnRuleList('growthRuleForm')">确定</el-button>
          </div>
        </el-tab-pane>
      </el-tabs>
  </div>
</div>
    
</template>

<script>
export default {
  data() {
    return {
      loading:true,
      setRule:true,//文字提示判断是新增还是编辑
      createOrUpdateRuleType:"添加成长值规则",//tab标题
      createOrUpdateSuccess:"创建成功",//tab标题
      obtainName: null,
      deptNames: null,
      detailDis: false,
      deptType: 0,
      deptMsg: "",
      editDis: false,
      costRadio: "3",
      whetherPicList: [],
      orderRadio: "3",
      detailShow: true,
      registered: false, //注册赠送
      order: false, //下单赠送
      appraisal: false, //评价赠送
      cost: false, //充值赠送
      share: false, //分享赠送
      goodsLike: false, //点赞赠送
      shareOrder: false, //晒单赠送
      collect: false, //收藏赠送
      customize: false, //自定义赠送
      activeName: "first",
      shopping: false,
      startTime: null,
      endTime: null,
      ruleNum: null,
      ruleName: null,
      deptId: null,
      status: null,
      consumeMode: null,
      editLoading: false,
      detailShow: true,
      imgUrl: "",
      ruleType: null,
      obtainModeList: [
        {obtainMode :"1" ,obtainName:"下单赠送"},
        {obtainMode :"2" ,obtainName:"注册赠送"},
        {obtainMode :"3" ,obtainName:"评价赠送"},
        {obtainMode :"4" ,obtainName:"充值赠送"},
        {obtainMode :"5" ,obtainName:"分享赠送"},
        {obtainMode :"6" ,obtainName:"点赞赠送"},
        {obtainMode :"7",obtainName:"晒单赠送"},
        {obtainMode :"8" ,obtainName:"收藏赠送"},
      ],
      filters: {
        startTime: null,
        endTime: null,
        ruleNum: null,
        ruleName: null,
        deptId: null,
        shopping: null,
        start: 1,
        limit: 10,
      },
      growthRuleForm: {
        id: null,
        status: null,
        ruleNum: null,
        ruleName: null,
        deptId: null,
        ruleType: null,
        obtainMode: null,
        consumeMode: null,
        orderHandleSel: [{ consumeMoney: "", giveGrowthVal: "" }], //阶梯消费x元赠送y成长值
        costHandleSel: [{ consumeMoney: "", giveGrowthVal: "" }], //阶梯充值X元赠送Y成长值
        appGiveGrowthVal: null,
        appGiveGrowthVals: null,
        appGiveGrowthMaxNum: null,
        appGiveGrowthMaxNums: null,
        giveGrowthVal: null,
        giveGrowthMaxNum: null,
        consumeMoney: null,
      },
      //添加校验
      growthRuleForms: {
        ruleName: [
          { required: true, message: "名称不能为空", trigger: "blur" }
        ],
        obtainMode: [
          { required: true, message: "获取方式不能为空", trigger: "blur" }
        ],
        giveGrowthVal: [
          { required: true, message: "请填写成长值规则", trigger: "blur" }
        ]
      },
      size: "small",
      align: "center",
    }
  },
  methods: {
    //第二步取消按钮
    returnRuleList(formName) {
      this.$router.push({path:"/Pages/User/MemberGrowthRule"});
    },

     //下拉选则获取方式
    selectModel(id) {
      let this_ = this;
      let obj = {};
      let selectModel = {};
      obj = this_.obtainModeList.find(item => {
        //model就是上面的数据源
        if (item.obtainMode == id) {
          this_.selectModel.obtainMode = id;
          this_.selectModel.ruleName = item.ruleName;
          this_.growthRuleForm.obtainMode=item.obtainMode;
        }
      });
    },
    // 设置可见性
    setDialogVisible: function (visible) {
      this.dialogVisible = visible
    },
    //上一步
    upStep(data) {
      if (data == 2) {
        this.activeName = "first";
      }
    },
    //成长值获取下一步
    nextStepRuleGrowth(data) {
      if (data == 1) {
        if ("" == this.growthRuleForm.obtainMode || null == this.growthRuleForm.obtainMode) {
          this.$message({ message: "请选择获取方式", type: "error" });
          return;
        }
        if ("" == this.growthRuleForm.ruleName || null == this.growthRuleForm.ruleName) {
          this.$message({ message: "请输入规则名称", type: "error" });
          return;
        }
        this.activeName = "second";
      } else if (data == 2) {
        let this_ = this;
        if (this_.growthRuleForm.obtainMode != 1 && this_.growthRuleForm.obtainMode != 4 && this_.growthRuleForm.obtainMode != 3) {
          if ("" == this_.growthRuleForm.giveGrowthVal || null == this_.growthRuleForm.giveGrowthVal) {
            this_.$message({ message: "请输入成长值规则", type: "error" });
            return;
          } else if ("" != this_.growthRuleForm.giveGrowthMaxNum && null != this_.growthRuleForm.giveGrowthMaxNum) {
            //判断每日成长上限是否为空
            if (Number(this_.growthRuleForm.giveGrowthVal) > Number(this_.growthRuleForm.giveGrowthMaxNum)) {
              this_.$message({
                message: "每日上限需大于或等于单次赠送值",
                type: "error"
              });
              return;
            } else {
              let params = Object.assign({}, this_.growthRuleForm);
            }
          } else {
            let params = Object.assign({}, this_.growthRuleForm);
          }
        } else if (this_.growthRuleForm.obtainMode == 1) {
          //如果是下单赠送
          /* 先判断是否是阶梯赠送 */
          if (this_.orderRadio != 6) {
            //如果不是阶梯赠送
            if (
              "" == this_.growthRuleForm.giveGrowthVal ||
              null == this_.growthRuleForm.giveGrowthVal
            ) {
              this_.$message({ message: "请输入成长值规则", type: "error" });
              return;
            } else if (
              "" == this_.growthRuleForm.consumeMoney ||
              null == this_.growthRuleForm.consumeMoney
            ) {
              this_.$message({ message: "请输入消费金额", type: "error" });
              return;
            } else if (null != this_.growthRuleForm.giveGrowthMaxNum && "" != this_.growthRuleForm.giveGrowthMaxNum) {
              if (
                Number(this_.growthRuleForm.giveGrowthVal) >
                Number(this_.growthRuleForm.giveGrowthMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.growthRuleForm);
                params.consumeType = 3;
              }
            } else {
              let params = Object.assign({}, this_.growthRuleForm);
              params.consumeType = 3;
            }
          } else {
            if (
              null == this_.growthRuleForm.giveGrowthMaxNum ||
              "" == this_.growthRuleForm.giveGrowthMaxNum
            ) {
              let temp = this_.growthRuleForm.orderHandleSel;
              let flag = false;
              for (let i = 0; i < temp.length; i++) {
                if (
                  "" == temp[i].giveGrowthVal ||
                  null == temp[i].giveGrowthVal ||
                  "" == temp[i].consumeMoney ||
                  null == temp[i].consumeMoney
                ) {
                  this_.$message({
                    message: "下单赠送成长值规则不能为空!请输入",
                    type: "error"
                  });
                  flag = false;
                  break;
                } else {
                  flag = true;
                }
              }
              if(!flag){
              return;
             }
            } else {
              let temp = this_.growthRuleForm.orderHandleSel;
              let flag = false;
              for (let i = 0; i < temp.length; i++) {
                if (
                  "" == temp[i].giveGrowthVal ||
                  null == temp[i].giveGrowthVal ||
                  "" == temp[i].consumeMoney ||
                  null == temp[i].consumeMoney
                ) {
                  this_.$message({
                    message: "下单赠送成长值规则不能为空!请输入",
                    type: "error"
                  });
                  flag = false;
                  break;
                } else {
                  flag = true;
                }
              }
              if(!flag){
                return;
              }
              let sum = Number(0);
              for (let j = 0; j < temp.length; j++) {
                sum += Number(temp[j].giveGrowthVal);
              }
              if (sum > this_.growthRuleForm.giveGrowthMaxNum) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              }
            }
            let params = Object.assign({}, this_.growthRuleForm);
            params.consumeType = 6;
          }
        } else if (this_.growthRuleForm.obtainMode == 4) {
          //如果是充值赠送
          /* 先判断是否是阶梯赠送 */
          if (this_.costRadio != 6) {
            //如果不是阶梯赠送
            if (
              "" == this_.growthRuleForm.giveGrowthVal ||
              null == this_.growthRuleForm.giveGrowthVal
            ) {
              this_.$message({ message: "请输入成长值规则", type: "error" });
              return;
            } else if (
              "" == this_.growthRuleForm.consumeMoney ||
              null == this_.growthRuleForm.consumeMoney
            ) {
              this_.$message({ message: "请输入充值金额", type: "error" });
              return;
            } else if (null != this_.growthRuleForm.giveGrowthMaxNum && "" !=this_.growthRuleForm.giveGrowthMaxNum) {
              if (
                Number(this_.growthRuleForm.giveGrowthVal) >
                Number(this_.growthRuleForm.giveGrowthMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.growthRuleForm);
                params.costType = 3;
              }
            } else {
              let params = Object.assign({}, this_.growthRuleForm);
              params.costType = 3;
            }
          } else {
            if (
              null == this_.growthRuleForm.giveGrowthMaxNum ||
              "" == this_.growthRuleForm.giveGrowthMaxNum
            ) {
              let temp = this_.growthRuleForm.costHandleSel;
              let flag = false;
              for (let i = 0; i < temp.length; i++) {
                if (
                  "" == temp[i].giveGrowthVal ||
                  null == temp[i].giveGrowthVal ||
                  "" == temp[i].consumeMoney ||
                  null == temp[i].consumeMoney
                ) {
                  this_.$message({
                    message: "下单赠送成长值规则不能为空!请输入",
                    type: "error"
                  });
                  flag = false;
                  break;
                } else {
                  flag = true;
                }
              }
              if(!flag){
                return;
              }
            } else {
              let temp = this_.growthRuleForm.costHandleSel;
              let flag = false;
              for (let i = 0; i < temp.length; i++) {
                if (
                  "" == temp[i].giveGrowthVal ||
                  null == temp[i].giveGrowthVal ||
                  "" == temp[i].consumeMoney ||
                  null == temp[i].consumeMoney
                ) {
                  this_.$message({
                    message: "下单赠送成长值规则不能为空!请输入",
                    type: "error"
                  });
                  flag = false;
                  break;
                } else {
                  flag = true;
                }
              }
              if(!flag){
                return;
              }
              let sum = Number(0);
              for (let j = 0; j < temp.length; j++) {
                sum += Number(temp[j].giveGrowthVal);
              }
              if (sum > this_.growthRuleForm.giveGrowthMaxNum) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              }
            }
            let params = Object.assign({}, this_.growthRuleForm);
            params.costType = 6;
          }
        } else if (this_.growthRuleForm.obtainMode == 3) {
          //如果是评价赠送
          /* 先判断评价类型 */
          if(this_.whetherPicList.length==0){
            this_.$message({
                message: "至少勾选一项",
                type: "error"
              });return;
          }
          if (this_.whetherPicList.length == 1 && this_.whetherPicList[0] == "带图"
          ) {
            if (
              "" == this_.growthRuleForm.appGiveGrowthVal ||
              null == this_.growthRuleForm.appGiveGrowthVal
            ) {
              this_.$message({
                message: "请输入带图评价赠送规则",
                type: "error"
              });
              return;
            } else if (null != this_.growthRuleForm.appGiveGrowthMaxNum) {
              if (
                Number(this_.growthRuleForm.appGiveGrowthVal) >
                Number(this_.growthRuleForm.appGiveGrowthMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.growthRuleForm);
                params.whetherPic = 1;
              }
            }
            let params = Object.assign({}, this_.growthRuleForm);
            params.whetherPic = 1;
          } else if (this_.whetherPicList.length == 1 && this_.whetherPicList[0] == "不带图") {
            if ("" == this_.growthRuleForm.appGiveGrowthVals || null == this_.growthRuleForm.appGiveGrowthVals) {
              this_.$message({message: "请输入不带图评价赠送规则", type: "error"});
              return;
            } else if (null != this_.growthRuleForm.appGiveGrowthMaxNums && "" != this_.growthRuleForm.appGiveGrowthMaxNums) {
              if (Number(this_.growthRuleForm.appGiveGrowthVals) > Number(this_.growthRuleForm.appGiveGrowthMaxNums)) {
                this_.$message({message: "每日上限需大于或等于单次赠送值", type: "error"});
                return;
              } else {
                let params = Object.assign({}, this_.growthRuleForm);
                params.whetherPic = 2;
              }
            }
            let params = Object.assign({}, this_.growthRuleForm);
            params.whetherPic = 2;
          } else {
            if (null == this_.growthRuleForm.appGiveGrowthVals || null == this_.growthRuleForm.appGiveGrowthVal) {
              this_.$message({ message: "请输入评价赠送规则", type: "error" });
              return;
            } else if (
              null != this_.growthRuleForm.appGiveGrowthMaxNums &&
              "" != this_.growthRuleForm.appGiveGrowthMaxNums &&
              null != this_.growthRuleForm.appGiveGrowthMaxNum &&
              "" != this_.growthRuleForm.appGiveGrowthMaxNum
            ) {
              if (
                Number(this_.growthRuleForm.appGiveGrowthVals) >
                Number(this_.growthRuleForm.appGiveGrowthMaxNums) ||
                Number(this_.growthRuleForm.appGiveGrowthVal) >
                  Number(this_.growthRuleForm.appGiveGrowthMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.growthRuleForm);
                params.whetherPic = 3;
              }
            } else if (
              null != this_.growthRuleForm.appGiveGrowthMaxNums &&
              "" != this_.growthRuleForm.appGiveGrowthMaxNums
            ) {
              if (
                Number(this_.growthRuleForm.appGiveGrowthVals) >
                Number(this_.growthRuleForm.appGiveGrowthMaxNums)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.growthRuleForm);
                params.whetherPic = 3;
              }
            } else {
              if (
                Number(this_.growthRuleForm.appGiveGrowthVal) >
                Number(this_.growthRuleForm.appGiveGrowthMaxNum)
              ) {
                this_.$message({
                  message: "每日上限需大于或等于单次赠送值",
                  type: "error"
                });
                return;
              } else {
                let params = Object.assign({}, this_.growthRuleForm);
                params.whetherPic = 3;
              }
            }
            let params = Object.assign({}, this_.growthRuleForm);
            params.whetherPic = 3;
          }
        } else if (this_.growthRuleForm.obtainMode > 8) {
          if (
            "" == this_.growthRuleForm.giveGrowthVal ||
            null == this_.growthRuleForm.giveGrowthVal
          ) {
            this_.$message({ message: "请输入成长值规则", type: "error" });
            return;
          } else if (
            "" != this_.growthRuleForm.giveGrowthMaxNum &&
            null != this_.growthRuleForm.giveGrowthMaxNum
          ) {
            //判断每日成长上限是否为空
            if (
              Number(this_.growthRuleForm.giveGrowthVal) >
              Number(this_.growthRuleForm.giveGrowthMaxNum)
            ) {
              this_.$message({
                message: "每日上限需大于或等于单次赠送值",
                type: "error"
              });
              return;
            } else {
              let params = Object.assign({}, this_.growthRuleForm);
            }
          } else {
            let params = Object.assign({}, this_.growthRuleForm);
          }
        }

        let params = Object.assign({}, this_.growthRuleForm);
        params.appGiveGrowthMaxNum = params.appGiveGrowthMaxNum ==""? 0:params.appGiveGrowthMaxNum;
        params.appGiveGrowthMaxNums = params.appGiveGrowthMaxNums ==""? 0:params.appGiveGrowthMaxNums;
        params.giveGrowthMaxNum = params.giveGrowthMaxNum ==""? 0:params.giveGrowthMaxNum;
        /*判断是否是阶梯类型*/
        if (this_.orderRadio == 3 && this.growthRuleForm.obtainMode == 1) {
          //适配对应的规则类型
          params.consumeType = 3;
        } else if (
          this_.orderRadio == 6 &&
          this.growthRuleForm.obtainMode == 1
        ) {
          params.consumeType = 6;
        } else if (
          this_.costRadio == 3 &&
          this.growthRuleForm.obtainMode == 4
        ) {
          params.costType = 3;
        } else if (
          this_.costRadio == 6 &&
          this.growthRuleForm.obtainMode == 4
        ) {
          params.costType = 6;
        }
        /* 判断是否带图 */
        if (this_.whetherPicList.length == 1 && this_.whetherPicList[0] == "带图") {
          params.whetherPic = 1;
        } else if (
          this_.whetherPicList.length == 1 &&
          this_.whetherPicList[0] == "不带图"
        ) {
          params.whetherPic = 2;
        } else {
          params.whetherPic = 3;
        }
        this_.utils.request.addGrowthRule(params, function(res) {
          if (res.data == "1") {
            this_.activeName = "third";
          } else {
            this_.$message({
              message: "规则名称不能重复，请重新输入",
              type: "error"
            });
          }
        });
      }
    },
        //新增充值赠送成长值规则
    addCostHandleSel() {
      if (this.growthRuleForm.costHandleSel.length > 9) {
        this.$message({ message: "新增最多不超过十条！", type: "error" });
      }
      let costArray = this.growthRuleForm.costHandleSel.push({});
      this.$set(
        this.growthRuleForm,
        this.growthRuleForm.costHandleSel,
        costArray
      );
    },
    // 删除充值赠送成长规则
    celarCostHandleSel(index) {
      let newArry = this.growthRuleForm.costHandleSel.splice(index, 1);
      this.$set(
        this.growthRuleForm,
        this.growthRuleForm.costHandleSel,
        newArry
      );
    },
    // 新增下单赠送成长值规则
    addOrderHandleSel() {
      if (this.growthRuleForm.orderHandleSel.length > 9) {
        this.$message({ message: "新增最多不超过十条！", type: "error" });
        return;
      }

      let orderArray = this.growthRuleForm.orderHandleSel.push({});
      this.$set(
        this.growthRuleForm,
        this.growthRuleForm.orderHandleSel,
        orderArray
      );
    },
    // 删除下单赠送成长规则
    celarOrderHandleSel(index) {
      let orderArray = this.growthRuleForm.orderHandleSel.splice(index, 1);
      this.$set(
        this.growthRuleForm,
        this.growthRuleForm.orderHandleSel,
        orderArray
      );
    },

  },
  mounted() {
    
  }
}
</script>
<style lang="scss" scoped>
.turnInlineBlock{
  display: inline-block;
}
/deep/ .w326{
 width: 326px !important;
}
.mb120{
  margin-bottom: 120px;
}
.mr60{
  margin-right: 60px !important;
}
.page-container-detail {
  padding: 35px 60px 60px !important;
}
.formItemNoMargin {
  margin-bottom: 0 !important;
}
.centerForm {
  text-align: center !important;
}
.overh{
  overflow: hidden;
}
.formItemNoMarginR{
  /deep/ .el-form-item{
    margin-right: 0 !important;
  }
}
.successImg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
.noMarginL {
  margin-left: 0 !important;
}
.textRed {
  color: red !important;
}
/deep/ .inputWidth200{
  width: 200px !important;
}
//下拉选择框icon对齐
.iconAlignment {
  /deep/ .el-input__icon {
    line-height: 32px !important;
  }
}

/deep/ .el-input__inner   {
  width: 200px !important;
}
/deep/ .el-form-item el-label{
      content: '*';
      color: #F56C6C;
      margin-right: 4px;
}
/deep/ .el-tabs__item.is-disabled{
        color: #333333;
        font-size: 16px;
      }
      /deep/ .el-tabs__item{
        padding: 0 30px;
      }
      /deep/ .el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),
      .el-tabs--bottom .el-tabs__item.is-top:nth-child(2),
      .el-tabs--top .el-tabs__item.is-bottom:nth-child(2),
      .el-tabs--top .el-tabs__item.is-top:nth-child(2){
        padding-left:0
      }
      /deep/ .el-tabs__active-bar{
        height: 4px;
        color: #409EFF;
        border-radius: 2px;
      }
      /deep/ .el-tabs__nav-wrap::after{
        height: 1px ;
      }
      /deep/ .el-tabs__header{
        margin-bottom: 40px !important;
      }
      .pl10{
        padding-left: 10px !important;
      }
      .mb10{
        margin-bottom: 10px !important;
      }
      .pl95{
        padding-left: 95px !important;
      }
      .colorE7{
        color: #E7AA4E !important;
      }
</style>